#ifndef SWP_ABSTRACT_DOCUMENT_H
#define SWP_ABSTRACT_DOCUMENT_H

#include "data/graphicdata.h"

#include <idocument.h>
#include <mimetype.h>

namespace swp
{

class SwpAbstractDocument : public core::IDocument
{
    Q_OBJECT

public:
    SwpAbstractDocument(const QString& name, const core::MimeType& mimeType,
        const QSharedPointer<core::IContainerDocument>& container,
        bool isFuture);
    ~SwpAbstractDocument();

    void setValid(bool valid);
    virtual bool isValid() const;

    bool isFuture() const;

    virtual bool isLinked() const;
    virtual bool isContainer() const;

    bool isDirty() const;
    QString name() const;

    core::MimeType mimeType() const;

    QSharedPointer<core::IContainerDocument> container() const;

    void setDirty(bool dirty = true);
    void setFuture(bool future = true);
    void setContainer(
        const QSharedPointer<core::IContainerDocument>& container);

    void rename(const QString& name);

    core::IDocumentData* data() const;

private slots:
    void makeDirty();

protected:
    bool m_valid;
    QString m_name;
    core::MimeType m_mimeType;
    bool m_isDirty;
    bool m_isFuture;
    QSharedPointer<core::IContainerDocument> m_container;
    mutable GraphicData m_data;
};

} // namespace swp

#endif
